using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Collections.Generic;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

namespace webapp4U.UI
{
    public partial class WebMaster_Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                DataBind();
            }
        }

        public override void DataBind()
        {

            GridViewItem.DataSource = webapp4U.BOL.Article.GetAllArticle("Get_All");
            GridViewItem.DataBind();

        }


        protected void btDelete_Click(object sender, EventArgs e)
        {
            foreach (GridViewRow row in GridViewItem.Rows)
            {
                bool isChecked = ((CheckBox)row.FindControl("chkSelect")).Checked;
                if (isChecked)
                {
                    int ArticleID = Convert.ToInt32(((CheckBox)row.FindControl("chkSelect")).ToolTip.Trim());
                    webapp4U.BOL.Article.Delete(ArticleID);
                }
            }
            DataBind();
        }


        protected void btSearch_Click(object sender, EventArgs e)
        {
            GridViewItem.DataSourceID = "SearchDataSource";
        }
    }
}